import { menuList } from "../../request/api";

const state = {
    list:[]
}

const mutations = {
    changeList(state,arr){
        state.list = arr
    }
}

const actions = {
    asyncList(context){
        menuList({
            istree:true
        }).then(res=>{
            context.commit("changeList",res.data.list)
        })
    }
}

const getters = {
    list(state){
        return state.list
    }

}

export default{
    state,
    mutations,
    actions,
    getters,
    // 开启命名空间
    namespaced: true
}